import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useCounterStore = defineStore(
  'counter',
  () => { 
    const count = ref(1)
	const add = () => {
		count.value++
	}
    return { count,add } 
  },
  {
    persist: {
      storage: {
        getItem(key) {
          return JSON.parse(uni.getStorageSync(key)); // 手动替代 destr
        },
        setItem(key, value) {
          uni.setStorageSync(key, JSON.stringify(value));
        },
      },
    }
  }
)